//
//  CenterFootView.swift
//  KaMengApplication
//
//  Created by DUONIU_MAC on 2018/9/11.
//  Copyright © 2018年 DUONIU_MAC. All rights reserved.
//

import UIKit

@objc protocol CenterDelegate {
    @objc optional func touchLoad(title:String) //点击展开
    @objc optional func selectCardType(title:String) //选择信用卡类型
    @objc optional func selectBankType(title:String,imageUrl:String) //选择银行信用卡
    @objc optional func moreBankCard(title:String) //更多银行信用卡
}

class CenterFootView: UIView {
    
    weak var centerDelegate : CenterDelegate?

    let articleView = ArticleView()
//    let centerView = CardCenterView()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        articleView.articleDelegate = self
        self.addSubview(articleView)
        
        articleView.snp.makeConstraints { (make) in
            make.top.left.right.bottom.equalToSuperview()
//            make.height.equalTo(RATIO_H(maxNum: 150))
        }
        
//        centerView.cardDelegate = self
//        self.addSubview(centerView)
//
//        centerView.snp.makeConstraints { (make) in
//            make.top.equalTo(articleView.snp.bottom)
//            make.left.right.equalToSuperview()
//            make.height.equalTo(RATIO_H(maxNum: 240))
//        }
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

}

extension CenterFootView : ArticleViewDelegate,CardCenterDelegate {
    
    //AMRK: 选择信用卡类型
    func selectCardType(title: String) {
        
        self.centerDelegate?.selectCardType!(title: title)
    }
    
    //MARK: 点击加载
    func touchLoad(title: String) {
        
        self.centerDelegate?.touchLoad!(title: title)
        
    }
    
    //MARK: 选择银行类型
    func selectBankType(title: String,imageUrl:String) {
        
        self.centerDelegate?.selectBankType!(title: title, imageUrl: imageUrl)
    }
    
    //MARK: 更多银行信息
    func moreBankCard(title: String) {
        
        self.centerDelegate?.moreBankCard!(title: title)
        
    }
    
}
